home *** CD-ROM | disk | FTP | other *** search
- Path: goanna.cs.rmit.EDU.AU!not-for-mail
- From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe)
- Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2
- Subject: Re: Hungarian notation - whoops!
- Date: 12 Feb 1996 19:02:10 +1100
- Organization: Comp Sci, RMIT, Melbourne, Australia
- Message-ID: <4fms62$c0p@goanna.cs.rmit.EDU.AU>
- References: <30C40F77.53B5@swsbbs.com> <Pine.HPP.3.91.960124153551.24374C-100000@zeezrom.cs.byu.edu> <4e7ifl$et3@goanna.cs.rmit.EDU.AU> <Pine.HPP.3.91.960129133429.8419C-100000@foggy.cs.byu.edu> <4em29qINN39r@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960201015336.17360C-100000@clear.cs.byu.edu> <4f41vf$g8j@goanna.cs.rmit.EDU.AU> <Pine.HPP.3.91.960205124102.18647E-100000@warm.cs.byu.edu> <4fc157$jsf@goanna.cs.rmit.EDU.AU> <dewar.823793746@schonberg>
- NNTP-Posting-Host: goanna.cs.rmit.edu.au
- NNTP-Posting-User: ok
- X-Newsreader: NN version 6.5.0 #0 (NOV)
-
- dewar@cs.nyu.edu (Robert Dewar) writes:
- >As far as I know, no current machine uses sign and magnitude representation
- >for integer values, so I obviously have a gap in my knowledge.
-
- The machine in question was the B6700. There have been changes, but the
- architecture is still in current production (I think they're called "A series"
- these days; check in comp.arch).
-
- >S&M representation is so hostile at a design level, that I thought everyone
- >had abandoned it long ago.
-
- >By the way, S&M is of course the right representation of floating-point,
- >using 2's complement for floating-point is a goof that only a designer
- >not understanding fpt would make!
-
- The B6700 integer format was a special case of the floating point format.
- The arithmetic instructions delivered exponent-zero results if they were
- given exponent-zero inputs and the result _could_ be so represented.
-
- I have done a paper design for a machine, but never a real machine.
- Sign and magnitude makes multiplication and division easy (just XOR the
- signs and operate on the absolute values). Comparison isn't any harder
- than 2s magnitude. If you can do addition and subtraction with 2s
- complement, you can certainly do it for sign and magnitude with only a
- couple more gate delays. I don't know whether that cost can be reduced,
- but it's certainly not obvious that it _can't_. Floating point is far
- more "hostile", but that doesn't stop people implementing it.
-
- >The comment about 2's complement being silly is a bit like saying you
- >think that the use of binary is silly. The choice of 2's complement,
- >like binary, is made for architectural reasons, not to be convenient
- >for humans.
-
- The underlying base is not something I usually have to think about.
- Most of my C code would work just as well in base 2, 3, 10, or even
- balanced ternary. But the fact that abs(x) may deliver a negative
- number is something I have to live with the whole time. _That_ is
- what I regard as silly. I don't particularly care for the fact that
- there are representable numbers X, Y for which X % Y may overflow,
- either. As far as I can see, the major "architectural
- reason" these days is "compatibility with existing C". (A little
- unfair, but not a lot unfair.) I remember the howls of dismay when
- RISC designers left out unaligned access; people don't put in unaligned
- access because they think it's a good thing, but for the "architectural
- reason" of selling into a market with lots of poor C code that people
- aren't (perhaps quite rationally) interested in fixing.
-
- I note that integer addition, subtraction, and comparison are single-
- cycle operations in many modern CPUs, and speculate that supporting
- sign and magnitude might not make any visible difference to performance.
- Things like pipelining, super-scalar, and caching probably make much
- more difference.
-
- I think that Dijkstra was right when he said "the purpose of machines is
- to execute our programs", and I call anything "silly" that forces me to
- work around arithmetic nasties in my source code.
-
- --
- "conventional orthography is ... a near optimal system for the
- lexical representation of English words." Chomsky & Halle, S.P.E.
- Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
-